<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php 
	$tournament_id = $_POST['tournament_id'];
	$cat_id = isset($_POST['cat_id']) ? $_POST['cat_id'] : '';
	$TOURNAMENT = $this->tournament_entity->init('id', $tournament_id);
?>
<?php if(!$cat_id): ?>
<form action="<?php echo site_url('admin/dataman/weekly_prize/category_submit');?>" name="category_submit" id="category_submit" method="post" enctype="multipart/form-data" >
	<input type="hidden" name="tournament_id" id="tournament_id" value="<?php echo $tournament_id;?>" />
	
	<div class="grid2"><span class="bold">*Title:</span></div>
	<div class="grid6"><input type="text" maxlength="100" id="title" name="title" value="" class="std-input"/></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*Start time:</span></div>
	<div class="grid6">
		<input type="text" maxlength="255" id="starttime" name="starttime" value="" class="std-input"/>
		<button id="start_time_btn">choose</button>
		<br/> <i>&nbsp; > <?php echo sysDateTimeFormat($TOURNAMENT->getStartTime());?></i>
	</div>
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*End time:</span></div>
	<div class="grid6">
		<input type="text" maxlength="255" id="endtime" name="endtime" value="" class="std-input"/>
		<button id="end_time_btn">choose</button>
		<br/> <i>&nbsp; < <?php echo sysDateTimeFormat($TOURNAMENT->getEndTime());?></i>
	</div>
	<div class="clrboth"></div>
	
	<div class="clrboth"></div>
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php else:?>
<form action="<?php echo site_url('admin/dataman/weekly_prize/category_submit');?>" name="category_submit" id="category_submit" method="post" enctype="multipart/form-data" >
	<?php 
		$PRIZE = $this->week_prize_entity->init('id',$cat_id);
	?>
	<div class="grid2"><span class="bold">*Title:</span></div>
	<div class="grid6"><input type="text" maxlength="100" id="title" name="title" value="<?php echo $PRIZE->getTitle();?>" class="std-input"/></div>
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*Start time:</span></div>
	<div class="grid6">
		<input type="text" maxlength="255" id="starttime" name="starttime" value="<?php echo sysDateTimeFormat($PRIZE->getStartTime() );?>" class="std-input"/>
		<button id="start_time_btn">choose</button>
		<br/> <i>&nbsp; > <?php echo sysDateTimeFormat($TOURNAMENT->getStartTime());?></i>
	</div>
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">*End time:</span></div>
	<div class="grid6">
		<input type="text" maxlength="255" id="endtime" name="endtime" value="<?php echo sysDateTimeFormat($PRIZE->getEndTime() );?>" class="std-input"/>
		<button id="end_time_btn">choose</button>
		<br/> <i>&nbsp; < <?php echo sysDateTimeFormat($TOURNAMENT->getEndTime());?></i>
	</div>
	<div class="clrboth"></div>
 
	<input type="hidden" name="cat_id" id="cat_id" value="<?php echo $cat_id;?>" />
	<input type="hidden" name="tournament_id" id="tournament_id" value="<?php echo $tournament_id;?>" />
	
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php endif;?>